Skip to content

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

dtolnay and others added 20 commits March 31, 2022 12:34
**Description**
 Add the `addr`, `with_addr, `map_addr` methods to the `NonNull` type,
 and map the address type to `NonZeroUsize`.

 **Motiviation**
 The `NonNull` type is useful for implementing pointer types which have
 the 0-niche. It is currently possible to implement these provenance
 preserving functions by calling `NonNull::as_ptr` and `new_unchecked`.
 The addition of these methods simply make it more ergonomic to use.

 **Testing**
 Added a unit test of a nonnull tagged pointer type. This is based on
 some real code I have elsewhere, that currently routes the pointer
 through a `NonZeroUsize` and back out to produce a usable pointer.
Handle rustc_const_stable attribute in library feature collector

The library feature collector in [compiler/rustc_passes/src/lib_features.rs](https://github.com/rust-lang/rust/blob/551b4fa395fa588d91cbecfb0cdfe1baa02670cf/compiler/rustc_passes/src/lib_features.rs) has only been looking at `#[stable(…)]`, `#[unstable(…)]`, and `#[rustc_const_unstable(…)]` attributes, while ignoring `#[rustc_const_stable(…)]`. The consequences of this were:

- When any const feature got stabilized (changing one or more `rustc_const_unstable` to `rustc_const_stable`), users who had previously enabled that unstable feature using `#![feature(…)]` would get told "unknown feature", rather than rustc's nicer "the feature … has been stable since … and no longer requires an attribute to enable".

    This can be seen in the way that rust-lang#93957 (comment) failed after rebase:

    ```console
    error[E0635]: unknown feature `const_ptr_offset`
      --> $DIR/offset_from_ub.rs:1:35
       |
    LL | #![feature(const_ptr_offset_from, const_ptr_offset)]
       |                                   ^^^^^^^^^^^^^^^^
    ```

- We weren't enforcing that a particular feature is either stable everywhere or unstable everywhere, and that a feature that has been stabilized has the same stabilization version everywhere, both of which we enforce for the other stability attributes.

This PR updates the library feature collector to handle `rustc_const_stable`, and fixes places in the standard library and test suite where `rustc_const_stable` was being used in a way that does not meet the rules for a stability attribute.
invalid_value lint: detect invalid initialization of arrays
…-DPC

Improve TyCtxt::type_of documentation

r? `@oli-obk`
…iagnostic, r=tmiasko

Add error message suggestion for missing noreturn in naked function

I had to google the syntax for inline asm's `noreturn` option when I got this error earlier today, so I figured I'd save others the trouble and add the syntax/fix as a suggestion in the error.
Implement provenance preserving methods on NonNull

### Description
 Add the `addr`, `with_addr`, `map_addr` methods to the `NonNull` type, and map the address type to `NonZeroUsize`.

 ### Motivation
 The `NonNull` type is useful for implementing pointer types which have  the 0-niche. It is currently possible to implement these provenance  preserving functions by calling `NonNull::as_ptr` and `new_unchecked`. The adding these methods makes it more ergonomic.

 ### Testing
 Added a unit test of a non-null tagged pointer type. This is based on some real code I have elsewhere, that currently routes the pointer through a `NonZeroUsize` and back out to produce a usable pointer. I wanted to produce an ideal version of the same tagged pointer struct that preserved pointer provenance.

### Related

Extension of APIs proposed in rust-lang#95228 . I can also split this out into a separate tracking issue if that is better (though I may need some pointers on how to do that).
Fix `thread_local!` macro to be compatible with `no_implicit_prelude`

Fixes issue  rust-lang#95533.
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Apr 1, 2022
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=7

@bors
Copy link
Collaborator

bors commented Apr 1, 2022

📌 Commit cd0afe1 has been approved by matthiaskrgr

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 1, 2022
@bors
Copy link
Collaborator

bors commented Apr 1, 2022

⌛ Testing commit cd0afe1 with merge 578e7df2389970b51e4243a7e54e95c03571f1f6...

@bors
Copy link
Collaborator

bors commented Apr 1, 2022

💔 Test failed - checks-actions

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 1, 2022
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 1, 2022
@matthiaskrgr
Copy link
Member Author

probably #95537

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 Documenting rustc_resolve v0.0.0 (/checkout/compiler/rustc_resolve)
error: unresolved link to `rustc_middle::ty::TyS`
   --> compiler/rustc_query_impl/src/plumbing.rs:268:45
    |
268 |             $(#[allow(nonstandard_style)] $(#[$attr])*
    |
   ::: compiler/rustc_query_impl/src/lib.rs:55:1
    |
    |
55  | rustc_query_append! { [define_queries!][<'tcx>] }
    |
    |
    = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
    = note: the link appears in this line:
            
            Returns the [`Ty`][rustc_middle::ty::TyS] of the given [`DefId`]. If the [`DefId`] points
    = note: no item named `TyS` in module `ty`
    = note: this error originates in the macro `define_queries` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unresolved link to `rustc_middle::ty::TyS`
error: unresolved link to `rustc_middle::ty::TyS`
   --> compiler/rustc_query_impl/src/plumbing.rs:485:17
    |
485 |             $($(#[$attr])*  $name: QueryState<query_keys::$name<$tcx>>,)*
    |
   ::: compiler/rustc_query_impl/src/lib.rs:55:1
    |
    |
55  | rustc_query_append! { [define_queries!][<'tcx>] }
    |
    = note: the link appears in this line:
            
            
            Returns the [`Ty`][rustc_middle::ty::TyS] of the given [`DefId`]. If the [`DefId`] points
    = note: no item named `TyS` in module `ty`
    = note: this error originates in the macro `define_queries_struct` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unresolved link to `rustc_middle::ty::TyS`
error: unresolved link to `rustc_middle::ty::TyS`
   --> compiler/rustc_query_impl/src/plumbing.rs:533:17
    |
533 |             $($(#[$attr])*
    |
   ::: compiler/rustc_query_impl/src/lib.rs:55:1
    |
    |
55  | rustc_query_append! { [define_queries!][<'tcx>] }
    |
    = note: the link appears in this line:
            
            
            Returns the [`Ty`][rustc_middle::ty::TyS] of the given [`DefId`]. If the [`DefId`] points
    = note: no item named `TyS` in module `ty`
    = note: this error originates in the macro `define_queries_struct` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not document `rustc_query_impl`
error: could not document `rustc_query_impl`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2021 --crate-type lib --crate-name rustc_query_impl compiler/rustc_query_impl/src/lib.rs --target aarch64-unknown-linux-gnu -o /checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=a8790594a3458556 -L dependency=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/release/deps --extern measureme=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/libmeasureme-97261aa370912d0f.rmeta --extern rustc_ast=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_ast-2d337973636fc2ea.rmeta --extern rustc_data_structures=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_data_structures-abca0a8f9995dcd4.rmeta --extern rustc_errors=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_errors-294c0c68448c7e72.rmeta --extern rustc_hir=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_hir-8483462c86bd4c42.rmeta --extern rustc_index=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_index-33e4452436cade9b.rmeta --extern rustc_macros=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/release/deps/librustc_macros-d9a25e4a2c275e29.so --extern rustc_middle=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_middle-e08b48a6392b4ba6.rmeta --extern rustc_query_system=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_query_system-0084c4b9adba4302.rmeta --extern rustc_serialize=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_serialize-4f5a742a80f150f2.rmeta --extern rustc_session=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_session-28d86d45ebf809c5.rmeta --extern rustc_span=/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_span-30179793ed0be8e1.rmeta --extern-html-root-url 'measureme=https://docs.rs/measureme/10.0.0/' -Zunstable-options -Csymbol-mangling-version=v0 -Zunstable-options '--check-cfg=names()' '--check-cfg=values()' '--check-cfg=values(bootstrap)' '--check-cfg=values(parallel_compiler)' '--check-cfg=values(no_btreemap_remove_entry)' '--check-cfg=values(crossbeam_loom)' '--check-cfg=values(span_locations)' -Dwarnings '-Wrustdoc::invalid_codeblock_attributes' --crate-version '1.61.0-nightly
  (578e7df23
  2022-04-01)' --document-private-items '-Arustdoc::private-intra-doc-links' --enable-index-page -Zunstable-options -Znormalize-docs --show-type-layout --generate-link-to-definition --extern-html-root-url 'ena=https://docs.rs/ena/latest/'` (exit status: 1)
[RUSTC-TIMING] rustc_infer test:false 6.545
[RUSTC-TIMING] rustc_resolve test:false 5.048
[RUSTC-TIMING] rustc_codegen_ssa test:false 5.137
[RUSTC-TIMING] rustc_query_impl test:false 9.848

@matthiaskrgr matthiaskrgr deleted the rollup-926lgaq branch July 30, 2022 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.